﻿using ClosedXML.Excel;
using CommHelper;
using Newtonsoft.Json;
using NX5Web.Controllers;
using NX5Web.Entities;
using NX5WinServies; 
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Security.Cryptography;
using System.Security.Policy;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Xml;
using Test.Generate;
using Test.Update;
using static NX5Web.Controllers.DoubaoController;
using static NX5Web.Controllers.ExcelController;
using static NX5Web.Controllers.MPController;
using static NX5WinServies.Sentence;
using static SDKs.AIDoubao;
using static System.Net.Mime.MediaTypeNames;

namespace Test
{
    internal class Program
    {
        public class js
        {
            public String SubjectTitle { set; get; }
        }

        public class per
        {
            public String src { set; get; }
        }

        static async Task Main(string[] args)
        {
            //await GenerateAudio.exec();
            await SDKs.AIDoubao.AIAudio("take somebody's breath away");
            //await UpdateWordMean.UpdateMean();
            //string ss = "<speak><phoneme alphabet=\"ipa\" ph=\"æ\">a</phoneme><break time=\"0.5s\"></break><phoneme alphabet=\"ipa\" ph=\"æ\">a</phoneme><break time=\"0.5s\"></break>apple</speak>";
            //await AIAudio(ss, "ssml");
            //DataManager dm = new DataManager();
            //DataTable dt = dm.SqlCmd("SELECT * FROM [dbo].[Base_Words] WHERE AISyllableDetail = 0").table;

            //string pattern = @"^[a-zA-Z]+$";


            //foreach (DataRow dr in dt.Rows)
            //{
            //    bool isMatch = Regex.IsMatch(dr["Word"].ToString(), pattern);
            //    Console.WriteLine(dr["ID"].ToString());
            //    if (isMatch)
            //    {
            //        String Text = "将" + dr["Word"].ToString() + "分音节，告诉我依据、注意点、常见误区，返回json格式：{\"Result\":分音节结果,\"SybCount\":音节数量,\"Important\":重音位置,\"Why\":[{\"WhyItem\":划分依据}],\"Notice\":[{\"NoticeItem\":注意点}],\"Error\":[{\"ErrorItem\":常见误区}]}";
            //        String JSON = await AIBase(Text, false);
            //        Console.WriteLine(JSON);
            //        dm.Procedure("Cus_UpdateWordSyllableDetail_SDE", "[{\"ID\":" + dr["ID"].ToString()
            //                + ",\"JSON\":\"" + TransData.Tran(JSON.Replace("}}","}")) + "\"}]");
            //    }
            //} 
        }
    }
}